#include"sales.h"

namespace SALES
{
void setSales(Sales&s,const double ar[],int n)
{
    double max = ar[0];
    double min = ar[0];
    for ( int i = 0; i < n; i++)
    {
       s.sales[i] = ar[i];
       s.average += ar[i] / 4;
       max = max >= ar[i] ? max : ar[i];
       min = min <= ar[i] ? min : ar[i];
    }
    s.max = max;
    s.min = min;
}

void setSales(Sales&s)
 {
    for ( int i = 0; i < QUARTERS; i++)
    {
        s.sales[i] = ( i + 1) * 10000.0;
        s.average += ( i + 1) * 2500.0;
    }
    s.max = s.sales[3];
    s.min = s.sales[0];
 }

void showSales(const Sales&s)
{
    cout << "The sales year details are as follows: " << endl;
    cout << "The spring sales is : " << s.sales[0] << endl;
    cout << "The summer sales is : " << s.sales[1] << endl;
    cout << "The autumn sales is : " << s.sales[2] << endl;
    cout << "The winter sales is : " << s.sales[3] << endl << endl;
    cout << "The sales average is : " << s.average << endl << endl;
    cout << "The sales max is : " << s.max << "\tand min is : " << s.min << endl << endl;
}
}